<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The SVM class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="svm.examples.html">« 范例</a></li>
      <li style="float: right;"><a href="svm.construct.html">SVM::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.svm.html">SVM</a></li>
    <li>The SVM class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.svm" class="reference">

 <h1 class="title">The SVM class</h1>
 

 <div class="partintro"><p class="verinfo">(PECL svm &gt;= 0.1.0)</p>


  <div class="section" id="svm.intro">
   <h2 class="title">简介</h2>
   <p class="para">

   </p>
  </div>


  <div class="section" id="svm.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">SVM</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.c-svc"><var class="varname">C_SVC</var></a></var><span class="initializer"> = 0</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.nu-svc"><var class="varname">NU_SVC</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.one-class"><var class="varname">ONE_CLASS</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.epsilon-svr"><var class="varname">EPSILON_SVR</var></a></var><span class="initializer"> = 3</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.nu-svr"><var class="varname">NU_SVR</var></a></var><span class="initializer"> = 4</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.kernel-linear"><var class="varname">KERNEL_LINEAR</var></a></var><span class="initializer"> = 0</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.kernel-poly"><var class="varname">KERNEL_POLY</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.kernel-rbf"><var class="varname">KERNEL_RBF</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.kernel-sigmoid"><var class="varname">KERNEL_SIGMOID</var></a></var><span class="initializer"> = 3</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.kernel-precomputed"><var class="varname">KERNEL_PRECOMPUTED</var></a></var><span class="initializer"> = 4</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-type"><var class="varname">OPT_TYPE</var></a></var><span class="initializer"> = 101</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-kernel-type"><var class="varname">OPT_KERNEL_TYPE</var></a></var><span class="initializer"> = 102</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-degree"><var class="varname">OPT_DEGREE</var></a></var><span class="initializer"> = 103</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-shrinking"><var class="varname">OPT_SHRINKING</var></a></var><span class="initializer"> = 104</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-propability"><var class="varname">OPT_PROPABILITY</var></a></var><span class="initializer"> = 105</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-gamma"><var class="varname">OPT_GAMMA</var></a></var><span class="initializer"> = 201</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-nu"><var class="varname">OPT_NU</var></a></var><span class="initializer"> = 202</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-eps"><var class="varname">OPT_EPS</var></a></var><span class="initializer"> = 203</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-p"><var class="varname">OPT_P</var></a></var><span class="initializer"> = 204</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-coef-zero"><var class="varname">OPT_COEF_ZERO</var></a></var><span class="initializer"> = 205</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-c"><var class="varname">OPT_C</var></a></var><span class="initializer"> = 206</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.svm.html#svm.constants.opt-cache-size"><var class="varname">OPT_CACHE_SIZE</var></a></var><span class="initializer"> = 207</span>;</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="svm.construct.html" class="methodname">__construct</a></span>()</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="svm.crossvalidate.html" class="methodname">svm::crossvalidate</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$problem</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$number_of_folds</code></span>): <span class="type">float</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="svm.getoptions.html" class="methodname">getOptions</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="svm.setoptions.html" class="methodname">setOptions</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$params</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="svm.train.html" class="methodname">svm::train</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$problem</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$weights</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="class.svmmodel.html" class="type SVMModel">SVMModel</a></span></div>

   }</div>


  </div>
  

  <div class="section" id="svm.constants">
   <h2 class="title">预定义常量</h2>
   <div class="section" id="svm.constants.types">
    <h2 class="title">SVM Constants</h2>
    <dl>

     
      <dt id="svm.constants.c-svc"><strong><code>SVM::C_SVC</code></strong></dt>

      <dd>

       <p class="para">The basic C_SVC SVM type. The default, and a good starting point</p>
      </dd>

     

     
      <dt id="svm.constants.nu-svc"><strong><code>SVM::NU_SVC</code></strong></dt>

      <dd>

       <p class="para">The NU_SVC type uses a different, more flexible, error weighting</p>
      </dd>

     

     
      <dt id="svm.constants.one-class"><strong><code>SVM::ONE_CLASS</code></strong></dt>

      <dd>

       <p class="para">One class SVM type. Train just on a single class, using outliers as negative examples</p>
      </dd>

     

     
      <dt id="svm.constants.epsilon-svr"><strong><code>SVM::EPSILON_SVR</code></strong></dt>

      <dd>

       <p class="para">A SVM type for regression (predicting a value rather than just a class)</p>
      </dd>

     

     
      <dt id="svm.constants.nu-svr"><strong><code>SVM::NU_SVR</code></strong></dt>

      <dd>

       <p class="para">A NU style SVM regression type</p>
      </dd>

     

     
      <dt id="svm.constants.kernel-linear"><strong><code>SVM::KERNEL_LINEAR</code></strong></dt>

      <dd>

       <p class="para">A very simple kernel, can work well on large document classification problems</p>
      </dd>

     

     
      <dt id="svm.constants.kernel-poly"><strong><code>SVM::KERNEL_POLY</code></strong></dt>

      <dd>

       <p class="para">A polynomial kernel</p>
      </dd>

     

     
      <dt id="svm.constants.kernel-rbf"><strong><code>SVM::KERNEL_RBF</code></strong></dt>

      <dd>

       <p class="para">The common Gaussian RBD kernel. Handles non-linear problems well and is a good default for classification</p>
      </dd>

     

     
      <dt id="svm.constants.kernel-sigmoid"><strong><code>SVM::KERNEL_SIGMOID</code></strong></dt>

      <dd>

       <p class="para">A kernel based on the sigmoid function. Using this makes the SVM very similar to a two layer sigmoid based neural network</p>
      </dd>

     

     
      <dt id="svm.constants.kernel-precomputed"><strong><code>SVM::KERNEL_PRECOMPUTED</code></strong></dt>

      <dd>

       <p class="para">A precomputed kernel - currently unsupported.</p>
      </dd>

     

     
      <dt id="svm.constants.opt-type"><strong><code>SVM::OPT_TYPE</code></strong></dt>

      <dd>

       <p class="para">The options key for the SVM type</p>
      </dd>

     

     
      <dt id="svm.constants.opt-kernel-type"><strong><code>SVM::OPT_KERNEL_TYPE</code></strong></dt>

      <dd>

       <p class="para">The options key for the kernel type</p>
      </dd>

     

     
      <dt id="svm.constants.opt-degree"><strong><code>SVM::OPT_DEGREE</code></strong></dt>

      <dd>

       <p class="para"/>
      </dd>

     

     
      <dt id="svm.constants.opt-shrinking"><strong><code>SVM::OPT_SHRINKING</code></strong></dt>

      <dd>

       <p class="para">Training parameter, boolean, for whether to use the shrinking heuristics</p>
      </dd>

     

     
      <dt id="svm.constants.opt-propability"><strong><code>SVM::OPT_PROBABILITY</code></strong></dt>

      <dd>

       <p class="para">Training parameter, boolean, for whether to collect and use probability estimates</p>
      </dd>

     

     
      <dt id="svm.constants.opt-gamma"><strong><code>SVM::OPT_GAMMA</code></strong></dt>

      <dd>

       <p class="para">Algorithm parameter for Poly, RBF and Sigmoid kernel types.</p>
      </dd>

     

     
      <dt id="svm.constants.opt-nu"><strong><code>SVM::OPT_NU</code></strong></dt>

      <dd>

       <p class="para">The option key for the nu parameter, only used in the NU_ SVM types</p>
      </dd>

     

     
      <dt id="svm.constants.opt-eps"><strong><code>SVM::OPT_EPS</code></strong></dt>

      <dd>

       <p class="para">The option key for the Epsilon parameter, used in epsilon regression</p>
      </dd>

     

     
      <dt id="svm.constants.opt-p"><strong><code>SVM::OPT_P</code></strong></dt>

      <dd>

       <p class="para">Training parameter used by Episilon SVR regression</p>
      </dd>

     

     
      <dt id="svm.constants.opt-coef-zero"><strong><code>SVM::OPT_COEF_ZERO</code></strong></dt>

      <dd>

       <p class="para">Algorithm parameter for poly and sigmoid kernels</p>
      </dd>

     

     
      <dt id="svm.constants.opt-c"><strong><code>SVM::OPT_C</code></strong></dt>

      <dd>

       <p class="para">The option for the cost parameter that controls tradeoff between errors and generality - effectively the penalty for misclassifying training examples. </p>
      </dd>

     

     
      <dt id="svm.constants.opt-cache-size"><strong><code>SVM::OPT_CACHE_SIZE</code></strong></dt>

      <dd>

       <p class="para">Memory cache size, in MB</p>
      </dd>

     
    </dl>

   </div>
  </div>



 </div>

 




































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="svm.construct.html">SVM::__construct</a> — Construct a new SVM object</li><li><a href="svm.crossvalidate.html">SVM::crossvalidate</a> — Test training params on subsets of the training data</li><li><a href="svm.getoptions.html">SVM::getOptions</a> — Return the current training parameters</li><li><a href="svm.setoptions.html">SVM::setOptions</a> — Set training parameters</li><li><a href="svm.train.html">SVM::train</a> — Create a SVMModel based on training data</li></ul>
</div>
</div></div></body></html>